
    Document   : UserForm
    Created on : 10/10/2011, 04:24:56 PM
    Author     : Alumnos


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<%@page import="Examen.lp1.Conexion" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
<%
String UserId=request.getParameter("UserId");
String Photo="";
String Name="";
String Login="";
String Password="";
String Email="";
String Celular="";
String ForcePasswordChange="";
String ActiveAccount="";
String Privilege="";
        Conexion conn = new Conexion();
        try {           
            String qry="select * from User where UserId=?";
            PreparedStatement ps=conn.getConnection().prepareStatement(qry);
            ps.setString(1, UserId);
            ResultSet rs= ps.executeQuery();
            if(rs.next())
            Name=rs.getString("Name");
            Login=rs.getString("Login");
            Password=rs.getString("Pasword");
            Email=rs.getString("Email");
            ForcePasswordChange=rs.getString("ForcePasswordChange");
            ActiveAccount=rs.getString("ActiveAccount");
            Privilege=rs.getString("Privilege");
            
            conn.close();
        } catch (Exception e) {
            out.print("Error: " +e.getMessage());
        }
%>               
    <form action="UserSave.jsp" name="fm">
            <br> <input type="hidden" name="go" value="Edit">
            <br>UserId <input type="text" name="UserId" value="<%=UserId%>" readonly="true">
            <br>Photo: <input type="text" name="Photo" value="<%=Photo%>">
            <br>Name: <input type="text" name="name" value="<%=Name%>">
            <br>Celular: <input type="text" name="celular" value="<%=Celular%>">
            <br>Login: <input type="text" name="login" value="<%=Login%>">
            <br>Password: <input type="text" name="Password" value="<%=Password%>">
            <br>Privilege: <input type="text" name="Privilege" value="<%=Privilege%>">
            <br>ActiveAccount: <input type="text" name="ActiveAccount" value="<%=ActiveAccount%>">
            <br>ForcePaswordChange:<input type="text" name="hrs" value="<%=ForcePasswordChange%>">
            <br><input type="submit" value="Edit">
            <input type="button" value="Eliminar" onclick="del()">
        </form>
    </body>
</html>
<script>
    function del(){
        document.fm.go.value="Delete";
        if(confirm("Está seguro eliminar?")) 
            document.fm.submit();
    }
</script>
